home *** CD-ROM | disk | FTP | other *** search
File List | 1986-10-19 | 15.6 KB | 535 lines |
- ' ******************
- ' *** CHOICE.LST ***
- ' ******************
- '
- DEFWRD "a-z"
- '
- > PROCEDURE choice.2(line,txt$,choice1$,choice2$,VAR choice)
- ' *** click on choice1 or choice2
- ' *** 12 characters allowed in line
- ' *** only High and Medium resolution
- ' *** uses Standard-Globals and Standard-Functions
- LOCAL txt.col,choice1.col,choice2.col,x,y,k,clicked!
- txt.col=scrn.col.max-(LEN(txt$)+50)
- choice1.col=36
- choice2.col=51
- choice1$=" "+choice1$+" " ! nicer with spaces
- choice2$=" "+choice2$+" "
- PRINT AT(txt.col,line);txt$;
- PRINT AT(choice1.col,line);choice1$;
- PRINT AT(choice2.col,line);choice2$;
- BOX (choice1.col-1)*8,(line-1)*char.height,(choice1.col+LEN(choice1$)-1)*8,line*char.height
- BOX (choice2.col-1)*8,(line-1)*char.height,(choice2.col+LEN(choice2$)-1)*8,line*char.height
- SHOWM
- clicked!=FALSE
- REPEAT
- MOUSE x,y,k
- IF y>(line-1)*char.height AND y<line*char.height
- IF k=1
- clicked!=TRUE
- IF x<50*8
- PRINT AT(choice1.col,line);@rev$(choice1$);
- choice=1
- ELSE
- PRINT AT(choice2.col,line);@rev$(choice2$);
- choice=2
- ENDIF
- ENDIF
- ENDIF
- UNTIL k=1 AND clicked!
- PAUSE 10
- RETURN
- ' **********
- '
- > PROCEDURE switch(line,txt$,VAR switch!)
- ' *** choice between ON and OFF
- ' *** only High or Medium resolution
- ' *** uses Standard-Globals and -Functions
- LOCAL txt.col,choice1.col,choice2.col,x,y,k,clicked!
- txt.col=scrn.col.max-(LEN(txt$)+50)
- choice1$=" ON "
- choice2$=" OFF "
- choice1.col=36
- choice2.col=51
- PRINT AT(txt.col,line);txt$;
- PRINT AT(choice1.col,line);choice1$;
- PRINT AT(choice2.col,line);choice2$;
- BOX (choice1.col-1)*8,(line-1)*char.height,(choice1.col+LEN(choice1$)-1)*8,line*char.height
- BOX (choice2.col-1)*8,(line-1)*char.height,(choice2.col+LEN(choice2$)-1)*8,line*char.height
- SHOWM
- clicked!=FALSE
- REPEAT
- MOUSE x,y,k
- IF y>(line-1)*char.height AND y<line*char.height
- IF k=1
- clicked!=TRUE
- IF x<50*8
- PRINT AT(choice1.col,line);@rev$(choice1$);
- switch!=TRUE
- ELSE
- PRINT AT(choice2.col,line);@rev$(choice2$);
- switch!=FALSE
- ENDIF
- ENDIF
- ENDIF
- UNTIL k=1 AND clicked!
- PAUSE 10
- RETURN
- ' **********
- '
- > PROCEDURE choice.3(line,txt$,choice1$,choice2$,choice3$,VAR choice)
- ' *** click on choice1, choice2 or choice3
- ' *** 12 characters allowed on line
- ' *** only High or Medium resolution
- ' *** uses Standard-Globals and -Functions
- LOCAL txt.col,choice1.col,choice2.col,choice3.col,x,y,k,clicked!
- txt.col=scrn.col.max-(LEN(txt$)+50)
- choice1.col=36
- choice2.col=51
- choice3.col=66
- choice1$=" "+choice1$+" " ! nicer with spaces
- choice2$=" "+choice2$+" "
- choice3$=" "+choice3$+" "
- PRINT AT(txt.col,line);txt$;
- PRINT AT(choice1.col,line);choice1$;
- PRINT AT(choice2.col,line);choice2$;
- PRINT AT(choice3.col,line);choice3$;
- BOX (choice1.col-1)*8,(line-1)*char.height,(choice1.col+LEN(choice1$)-1)*8,line*char.height
- BOX (choice2.col-1)*8,(line-1)*char.height,(choice2.col+LEN(choice2$)-1)*8,line*char.height
- BOX (choice3.col-1)*8,(line-1)*char.height,(choice3.col+LEN(choice3$)-1)*8,line*char.height
- SHOWM
- clicked!=FALSE
- REPEAT
- MOUSE x,y,k
- IF y>(line-1)*char.height AND y<line*char.height
- IF k=1
- clicked!=TRUE
- IF x<50*8
- PRINT AT(choice1.col,line);@rev$(choice1$);
- choice=1
- ELSE
- IF x>=50*8 AND x<65*8
- PRINT AT(choice2.col,line);@rev$(choice2$);
- choice=2
- ELSE
- PRINT AT(choice3.col,line);@rev$(choice3$);
- choice=3
- ENDIF
- ENDIF
- ENDIF
- ENDIF
- UNTIL k=1 AND clicked!
- PAUSE 10
- RETURN
- ' **********
- '
- > PROCEDURE choice.table(line,VAR proc.table$(),proc.choice())
- ' *** first call Procedure Initio.table
- ' *** click on choices in table
- ' *** only High or Medium resolution
- ' *** uses Standard-Globals and -Functions
- LOCAL n,lines,choice1.col,choice2.col,choice3.col,txt.col,default
- LOCAL clicked!,ok!,nummer,choice1$,choice2$,choice3$,x,y,k,reg
- lines=DIM?(proc.choice())-1
- choice1.col=36
- choice2.col=51
- choice3.col=66
- FOR n=1 TO lines
- reg=line+2*(n-1)
- txt$=proc.table$(n,0)
- choice1$=" "+proc.table$(n,1)+" " ! nicer with spaces
- choice2$=" "+proc.table$(n,2)+" "
- choice3$=" "+proc.table$(n,3)+" "
- txt.col=scrn.col.max-(LEN(txt$)+50)
- default=proc.choice(n)
- PRINT AT(txt.col,reg);txt$;
- PRINT AT(choice1.col,reg);choice1$;
- PRINT AT(choice2.col,reg);choice2$;
- BOX (choice1.col-1)*8,(reg-1)*char.height,(choice1.col+LEN(choice1$)-1)*8,reg*char.height
- BOX (choice2.col-1)*8,(reg-1)*char.height,(choice2.col+LEN(choice2$)-1)*8,reg*char.height
- IF proc.table$(n,3)>""
- PRINT AT(choice3.col,reg);choice3$;
- BOX (choice3.col-1)*8,(reg-1)*char.height,(choice3.col+LEN(choice3$)-1)*8,reg*char.height
- ENDIF
- IF default>0
- PRINT AT(choice1.col+(default-1)*15,reg);@rev$(" "+proc.table$(n,default)+" ");
- ENDIF
- NEXT n
- PRINT AT(38,24);" OK ";
- DEFLINE 1,3
- BOX 37*8,23*char.height,41*8,24*char.height
- DEFLINE 1,1
- SHOWM
- clicked!=FALSE
- ok!=FALSE
- REPEAT
- REPEAT
- MOUSE x,y,k
- in$=INKEY$
- IF in$=return$
- ok!=TRUE
- PRINT AT(38,24);@rev$(" OK ");
- ENDIF
- EXIT IF ok!
- IF y>(line-1)*char.height AND y<(line+2*lines)*char.height
- IF k=1
- clicked!=TRUE
- nummer=(y/char.height+1-line)/2+1
- choice1$=" "+proc.table$(nummer,1)+" "
- choice2$=" "+proc.table$(nummer,2)+" "
- choice3$=" "+proc.table$(nummer,3)+" "
- reg=line+2*(nummer-1)
- IF x<50*8
- PRINT AT(choice1.col,reg);@rev$(choice1$);
- PRINT AT(choice2.col,reg);choice2$;
- BOX (choice2.col-1)*8,(reg-1)*char.height,(choice2.col+LEN(choice2$)-1)*8,reg*char.height
- IF proc.table$(nummer,3)>""
- PRINT AT(choice3.col,reg);choice3$;
- BOX (choice3.col-1)*8,(reg-1)*char.height,(choice3.col+LEN(choice3$)-1)*8,reg*char.height
- ENDIF
- proc.choice(nummer)=1
- ELSE
- IF (x>=50*8 AND x<65*8 AND choice3$>"") OR (x>=50*8 AND choice3$="")
- PRINT AT(choice1.col,reg);choice1$;
- BOX (choice1.col-1)*8,(reg-1)*char.height,(choice1.col+LEN(choice1$)-1)*8,reg*char.height
- PRINT AT(choice2.col,reg);@rev$(choice2$);
- IF proc.table$(nummer,3)>""
- PRINT AT(choice3.col,reg);choice3$;
- BOX (choice3.col-1)*8,(reg-1)*char.height,(choice3.col+LEN(choice3$)-1)*8,reg*char.height
- ENDIF
- proc.choice(nummer)=2
- ELSE
- PRINT AT(choice1.col,reg);choice1$;
- BOX (choice1.col-1)*8,(reg-1)*char.height,(choice1.col+LEN(choice1$)-1)*8,reg*char.height
- PRINT AT(choice2.col,reg);choice2$;
- BOX (choice2.col-1)*8,(reg-1)*char.height,(choice2.col+LEN(choice2$)-1)*8,reg*char.height
- PRINT AT(choice3.col,reg);@rev$(choice3$);
- proc.choice(nummer)=3
- ENDIF
- ENDIF
- ENDIF
- ENDIF
- IF y>23*char.height
- IF k=1
- PRINT AT(38,24);@rev$(" OK ");
- ok!=TRUE
- ENDIF
- ENDIF
- UNTIL k=1 AND (clicked! OR ok!)
- PAUSE 10
- UNTIL ok!
- RETURN
- ' ***
- > PROCEDURE initio.table
- ' *** global : TABLE$() CHOICE()
- ' *** 1e DATA-line : number of lines
- ' *** following DATA-lines : 1st choice,2nd choice,[3rd choice],*,0/1/2/3
- ' *** 3rd choice optional; last number is default choice
- ' *** 12 characters allowed on one line
- LOCAL n,i,lines,x$,default
- initio.table:
- DATA 3
- DATA 1st line,1st choice,2nd choice,*,1
- DATA 2nd question,first,second,third,*,0
- DATA 3rd possibility,on,off,*,2
- RESTORE initio.table
- READ lines
- ERASE table$(),choice()
- DIM table$(lines,3),choice(lines)
- FOR n=1 TO lines
- i=0
- DO
- READ x$
- EXIT IF x$="*"
- table$(n,i)=x$
- INC i
- LOOP
- READ default
- choice(n)=default
- NEXT n
- RETURN
- ' **********
- '
- > PROCEDURE dial.number(line,txt$,default,min,max,step1,step2,cycle!,VAR choice)
- ' *** choose number with mouse
- ' *** after pressing <Help>, a short description appears
- ' *** only High or Medium resolution
- ' *** uses Standard-Globals and -Procedures
- LOCAL c,txt.col,fld,tot.fld,fld$,clr.fld$,dwn.col,num.col,up.col
- LOCAL x.lft,x.rgt,x,y,k,in$,dial!,delta
- c=char.height
- txt.col=scrn.col.max-(LEN(txt$)+50)
- PRINT AT(txt.col,line);txt$;
- fld=LEN(STR$(max))
- tot.fld=fld+6
- fld$=STRING$(fld,"#")
- LET clr.fld$=SPACE$(LEN(fld$))
- dwn.col=37
- x.lft=(dwn.col+1)*8
- x.rgt=(dwn.col+tot.fld-3)*8
- num.col=dwn.col+3
- up.col=dwn.col+fld+5
- PRINT AT(dwn.col-1,line);" ";
- OUT 5,2
- PRINT AT(up.col-1,line);" ";
- OUT 5,1
- PRINT AT(num.col,line);USING fld$,default;
- BOX (dwn.col-2)*8,(line-1)*c-1,(dwn.col+tot.fld)*8,line*c
- LINE x.lft,(line-1)*c,x.lft,line*c
- LINE x.rgt,(line-1)*c,x.rgt,line*c
- DEFMOUSE 0
- SHOWM
- choice=default
- dial!=FALSE
- DO
- MOUSE x,y,k
- in$=INKEY$
- IF in$=return$
- dial!=TRUE
- ENDIF
- IF in$=help$
- @help.dial.number
- ENDIF
- IF y>(line-1)*c AND y<(line)*c+1
- IF k=1 OR k=2
- IF x>x.lft AND x<(dwn.col+tot.fld-3)*8
- dial!=TRUE
- ENDIF
- IF x<x.lft
- delta=step1*(k=1)+step2*(k=2)
- ENDIF
- IF x>x.rgt
- delta=-step1*(k=1)-step2*(k=2)
- ENDIF
- IF NOT dial!
- choice=choice+delta
- IF choice>max
- IF NOT cycle!
- choice=max
- PRINT bel$;
- ELSE
- choice=min+(choice-max)
- ENDIF
- ENDIF
- IF choice<min
- IF NOT cycle!
- choice=min
- PRINT bel$;
- ELSE
- choice=max-(min-choice)
- ENDIF
- ENDIF
- PRINT AT(num.col,line);clr.fld$;
- PRINT AT(num.col,line);USING fld$,choice
- PAUSE 5
- ENDIF
- ENDIF
- ENDIF
- EXIT IF dial!
- LOOP
- PRINT AT(dwn.col,line);SPACE$(tot.fld)
- PRINT AT(num.col,line);USING fld$,choice
- BOX (dwn.col-2)*8,(line-1)*c-1,(dwn.col+tot.fld)*8,line*c
- RETURN
- ' ***
- > PROCEDURE help.dial.number
- LOCAL screen$
- SGET screen$
- CLS
- PRINT AT(1,4);" ";
- OUT 5,2
- PRINT " = decrease number with mouse-click (lowest value = ";min;")"
- PRINT
- PRINT " ";
- OUT 5,1
- PRINT " = increase number with mouse-click (highest value = ";max;")"
- PRINT
- PRINT " left button : 1 click = ";step1
- PRINT
- PRINT " right button : 1 click = ";step2
- PRINT
- IF cycle!
- PRINT " cycles from highest value to lowest value (and back)"
- PRINT
- ENDIF
- PRINT " choose number by mouse-click or by pressing <Return>"
- @return.key
- SPUT screen$
- RETURN
- ' **********
- '
- > PROCEDURE pop.choice(x,y,VAR pop.choice!())
- ' *** first call Procedure Initio.pop.choice
- ' *** pop=up menu appears at (x,y)
- ' *** High resolution only
- ' *** after pressing <Help>, a short description appears
- ' *** you can click one or more lines
- ' *** original screen is restored
- LOCAL n,xb2%,lines,height,width,i,r$,m0,m1,y_pos,c,f,top,f_pos,mx,my,mk
- LOCAL screen$,in$
- n=DIM?(pop.choice$())-1
- ERASE pop.choice!()
- DIM pop.choice!(n)
- xb2%=XBIOS(2)
- '
- IF n>10 ! width, height and position of box
- height=260
- lines=13
- ELSE
- height=n*20+20
- lines=n
- ENDIF
- width=LEN(pop.choice$(0))
- FOR i=1 TO n
- width=MAX(LEN(pop.choice$(i)),width)
- NEXT i
- width=(width+4)*8
- x=MIN(x,639-width-16)
- y=MIN(y,125)
- x=MAX(x,10)
- y=MAX(y,20)
- '
- GET x-3,y-3,x+width+3,y+height+3,r$
- '
- ACLIP 1,0,0,639,399 ! box + text
- m1=-1
- ARECT x-3,y-2,x+width+3,y+height+2,1,0,V:m1,0
- m0=0
- ARECT x,SUCC(y),x+width,PRED(y+height),1,0,V:m0,0
- y_pos=y+20
- FOR i=1 TO lines
- HLINE x,y_pos,x+width,1,0,V:m1,0
- ADD y_pos,20
- NEXT i
- c=width/8-2
- IF lines=13
- y_pos=y+42
- ATEXT x+8,y+22,2,STRING$(c,1)
- ATEXT x+8,y+242,2,STRING$(c,2)
- ELSE
- y_pos=y+22
- ENDIF
- ATEXT x+8+(c-LEN(pop.choice$(0)))*4,y+7,1,pop.choice$(0)
- FOR i=1 TO MIN(lines,10)
- ATEXT x+8+(c-LEN(pop.choice$(i)))*4,y_pos,2,pop.choice$(i)
- ADD y_pos,20
- NEXT i
- '
- top=0
- f=-1
- REPEAT
- UNTIL INKEY$=""
- REPEAT ! menu-selection loop
- MOUSE mx,my,mk
- '
- in$=INKEY$
- IF in$=help$
- SGET screen$
- CLS
- PRINT AT(1,6);" click left mouse-button to make (or undo) choice"
- PRINT
- IF lines>10
- PRINT " scroll one line with left mouse-button"
- PRINT
- PRINT " scroll to begin or end with right mouse-button"
- PRINT
- ENDIF
- PRINT
- PRINT
- PRINT " press right button outside box to leave menu"
- ~INP(2)
- SPUT screen$
- in$=""
- ENDIF
- '
- IF mx>x AND mx<x+width AND my>y+20 AND my<y+height ! mouse on choice
- IF TRUNC((my-y)/20)<>f
- IF f<>-1
- ARECT SUCC(x),y+f*20+2,PRED(x+width),y+f*20+18,1,2,V:m1,0
- ENDIF
- f=TRUNC((my-y)/20)
- ARECT SUCC(x),y+f*20+2,PRED(x+width),y+f*20+18,1,2,V:m1,0
- ENDIF
- ELSE
- IF f<>-1
- ARECT SUCC(x),y+f*20+2,PRED(x+width),y+f*20+18,1,2,V:m1,0
- ENDIF
- f=-1
- ENDIF
- '
- IF mk=1
- IF (f>1 AND f<12 AND lines=13) OR (f>0 AND f<11 AND lines<>13)
- f_pos=f+top ! choice clicked
- IF lines=13
- DEC f_pos
- ENDIF
- pop.choice!(f_pos)=NOT pop.choice!(f_pos)
- IF pop.choice!(f_pos)
- ARECT SUCC(x),y+f*20+2,PRED(x+width),y+f*20+18,1,2,V:m1,0
- ATEXT PRED(x+width)-8,y+f*20+2,2,CHR$(8)
- ARECT SUCC(x),y+f*20+2,PRED(x+width),y+f*20+18,1,2,V:m1,0
- ELSE
- ARECT PRED(x+width)-8,y+f*20+2,PRED(x+width),y+f*20+18,1,0,V:m1,0
- ENDIF
- WHILE MOUSEK
- WEND
- MOUSE mx,my,mk
- ENDIF
- ENDIF
- '
- IF lines=13 AND (f=1 OR f=12) AND mk ! scroll
- IF f=1 ! scroll down
- IF top>0
- RC_COPY xb2%,SUCC(x),y+40,PRED(width),height-80 TO xb2%,SUCC(x),y+60
- ARECT SUCC(x),y+41,PRED(x+width),y+59,1,0,V:m0,0
- ATEXT x+8+(c-LEN(pop.choice$(top)))*4,y+42,2,pop.choice$(top)
- IF pop.choice!(top)
- ATEXT PRED(x+width)-8,y+42,2,CHR$(8)
- ENDIF
- DEC top
- ENDIF
- ELSE
- IF top+11<=n ! scroll up
- RC_COPY xb2%,SUCC(x),y+60,PRED(width),height-80 TO xb2%,SUCC(x),y+40
- ARECT SUCC(x),y+221,PRED(x+width),y+239,1,0,V:m0,0
- ATEXT x+8+(c-LEN(pop.choice$(top+11)))*4,y+222,2,pop.choice$(top+11)
- IF pop.choice!(top+11)
- ATEXT PRED(x+width)-8,y+222,2,CHR$(8)
- ENDIF
- INC top
- ENDIF
- ENDIF
- WHILE MOUSEK=1
- WEND
- mk=0
- ENDIF
- '
- UNTIL mk=2 AND f=-1 ! quit menu
- PUT x-3,y-3,r$
- ACLIP 0,0,0,639,399
- RETURN
- ' ***
- > PROCEDURE initio.pop.choice
- ' *** global : POP.CHOICE$()
- LOCAL n,i,pop$
- RESTORE pop.data
- n=-1
- REPEAT
- READ pop$
- INC n
- UNTIL pop$="***"
- DEC n
- DIM pop.choice$(n)
- RESTORE pop.data
- FOR i=0 TO n
- READ pop.choice$(i)
- NEXT i
- '
- pop.data:
- DATA menu-title
- DATA 1st choice,2nd choice,3rd choice
- DATA ***
- RETURN
- ' **********
- '
-